package ${package.Controller};

import com.liqi.frame.comm.aop.FormPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import ${package.Service}.${table.serviceName};
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>

/**
 * <p>
 * ${table.comment} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
    private String prefix = "${cfg.moduleName}";

    @RequestMapping({"${table.entityPath}"})
    public ModelAndView ${table.entityPath}(HttpServletRequest request) {
        return new ModelAndView(prefix+"/${table.entityPath}");
    }

    @FormPage(menu = "${table.entityPath}Form")
    @RequestMapping({"${table.entityPath}Form", "form/${table.entityPath}Form"})
    public ModelAndView ${table.entityPath}Form(HttpServletRequest request) {
        return new ModelAndView(prefix+"/${table.entityPath}Form");
    }
}
</#if>
